package com.czh.springboot04.service.serviceimpl;

import com.czh.springboot04.entity.Company;
import com.czh.springboot04.mapper.CompanyMapper;
import com.czh.springboot04.service.CompanyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CompanyServiceImpl implements CompanyService {
@Autowired
    private CompanyMapper companyMapper;
    @Override
    public int companyAdd(Company company) {
        int i = companyMapper.companyAdd(company);
        return i;
    }

    @Override
    public int companyUpdate(Company company) {
        int i = companyMapper.companyUpdate(company);
        return i;
    }

    @Override
    public int companyDelete(int id) {
        return companyMapper.companyDelete(id);
    }

    @Override
    public PageInfo<Company> companySelectAll(int pageNum, int pageSize, Company company) {
        PageHelper.startPage(pageNum,pageSize);
        List<Company> list = companyMapper.companySelectAll(company);
        PageInfo<Company> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
